<template>
    <div class="mui-numbox" data-numbox-min='1'>
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input type="number" value="1" class="mui-input-numbox" @change='countChanged' ref='numbox'/>
        <button type="button" class="mui-btn mui-btn-numbox-plus">+</button>
    </div>
</template>
<script>
import mui from '../../lib/mui/js/mui.min.js'
export default {
    name: "",
    mounted() {
        //do something after mounting vue instance
        mui(".mui-numbox").numbox();
        console.log(this.max);
    },
    methods: {
        countChanged() {
            this.$emit("getcount",parseInt(this.$refs.numbox.value));
        }
    },
    props: ['max'],
    watch: {
        //属性监听
        max: function(newVal,oldValue) {
            mui(".mui-numbox")
                .numbox()
                .setOption("max",newVal);
        }
    }
}
</script>
<style lang="scss" scoped>
</style>
